<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script>
    $(function () {
        $("#examApplyTable").treeTable();
    })
    function selectExamApply(applyId,name){
        $("#applyId").val(applyId) ;
        $("#name").val(name) ;
    }
    $('#printExamApply').click(function(){
        /*var applyId = $("#applyId").val();
        var name = $("#name").val();
        if(applyId==""){
            toastr.error('请先选择病人');
        }else{
            window.open("${ctx}/nurse/print/examApplyPrint?applyId="+applyId+"&name="+name)
        }*/

        printPdf('${ctx}/nurse/printExamApply');
    });


</script>
<div class="app">
        <div class="content-wrap">
            <ul class="nav nav-tabs">
                <li><a href="#" onclick="loadDiv('nurseIndexDiv','${ctx}/nurse/index')">床位列表</a></li>
                <li class="active">
                    <a href="#">检查单</a>
                </li>
            </ul>
            <section class="panel panel-default">
                <div class="panel-body">
                    <div class="table-responsive no-border">
                        <div class="datatable-top">
                            <div class="pull-left">
                                 <form  id="examApplyForm" onsubmit="return loadDivForm('nurseIndexDiv','examApplyForm','${ctx}/nurse/examApply');" method="post" class="form-inline">
                                     <label>申请时间：</label><input value="${startDate}" name="startDate" class="form-control Wdate" id="startDate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});">至<input class="form-control Wdate"id="endDate" value="${endDate}" name="endDate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});">
                                     <input name="date" id="week" class="btn btn-default" type="button" value="一周内" onclick="dateCondition('week',-7,'startDate')"/>
                                     <input name="date" id="halfMonth" class="btn btn-default" type="button" value="半月内" onclick="dateCondition('halfMonth',-15,'startDate')"/>
                                     <input name="date"  id="month" class="btn btn-default" type="button" value="一个月内" onclick="dateCondition('month',-30,'startDate')"/>
                                     <input  class="btn btn-primary" type="submit" value="查询"/>
                                     &nbsp;&nbsp;<input class="btn btn-primary" id="printExamApply" type="submit" value="打印"/>
                                 </form>
                            </div>
                            </div>
                        <input type="hidden" id="applyId" value="">
                        <input type="hidden" id="name" value="">
                            <table id="examApplyTable" class="table table-bordered mg-t datatable">
                                <thead>
                                <tr>
                                    <th>检查序号</th>
                                    <th>申请时间</th>
                                    <th>姓名</th>
                                    <th>性别</th>
                                    <th>确认标志</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach items="${page.list}" var="examApply" varStatus="ex">
                                    <tr style="cursor: pointer" onclick = selectExamApply('${examApply.id}','${examApply.patMasterIndex.name}') id="${examApply.id}">
                                        <td>${examApply.applyOn}</td>
                                        <td><fmt:formatDate value="${examApply.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                        <td>${examApply.patMasterIndex.name}</td>
                                        <td>${fns:getDictLabels(examApply.patMasterIndex.sex, 'SEX_DICT', '')}</td>
                                        <td><c:if test="${examApply.confirmFlag=='0'}">未确认</c:if>
                                            <c:if test="${examApply.confirmFlag=='1'}">已确认</c:if>
                                        </td>
                                    </tr>
                                    <c:if test="${examApply.examItemList.size()>0}">
                                        <tr id="${ex.count}" pid="${examApply.id}">
                                            <td colspan="5">
                                                <table class="table table-bordered mg-t">
                                                    <tr>
                                                        <th>检查项目</th>
                                                        <th>项目代码</th>
                                                        <th>价格</th>
                                                    </tr>
                                                    <c:forEach items="${examApply.examItemList}" var="examItems" varStatus="ss">
                                                        <tr>
                                                            <td>${examItems.itemName}</td>
                                                            <td>${examItems.itemCode}</td>
                                                            <td>${examItems.costs}</td>
                                                        </tr>
                                                    </c:forEach>
                                                </table>
                                            </td>
                                        </tr>
                                    </c:if>
                                </c:forEach>
                                </tbody>
                            </table>
                        <div class="pagination">${page}</div>
                     </div>
                </div>
            </section>
        </div>
</div>
</div>
</div>